﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ggprot;

namespace GGTest
{
    public partial class Status : Form
    {
        private GaduProtocol protocol;

        public Status(GaduProtocol prot)
        {
            InitializeComponent();

            this.protocol = prot;

            List<KeyValuePair<string, int>> statuses = new List<KeyValuePair<string, int>>();
            statuses.Add(new KeyValuePair<string, int>("Dostępny", 0x2));
            statuses.Add(new KeyValuePair<string, int>("Zaraz wracam", 0x3));
            statuses.Add(new KeyValuePair<string, int>("Pogadajmy", 0x17));
            statuses.Add(new KeyValuePair<string, int>("Nie przeszkadzać", 0x21));
            statuses.Add(new KeyValuePair<string, int>("Niewidoczny", 0x14));
            statuses.Add(new KeyValuePair<string, int>("Niedostępny", 0x1));

            comboBox1.DataSource = statuses;
            comboBox1.DisplayMember = "key";
            comboBox1.ValueMember = "value";

            richTextBox1.Text = prot.Description;
            comboBox1.SelectedValue = (int)prot.TranslateStatus(prot.Status);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            protocol.SetStatus(protocol.TranslateStatus((ggprot.Status)(int)comboBox1.SelectedValue, !string.IsNullOrEmpty(richTextBox1.Text)), richTextBox1.Text);
            Close();
        }
    }
}
